import java.util.Scanner;

public class work12 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入第一个正整数：");
        int m = scanner.nextInt();
        System.out.print("请输入第二个正整数：");
        int n = scanner.nextInt();

        int gcd = gcd(m, n);
        int lcm = m * n / gcd;

        System.out.println("最大公约数是：" + gcd);
        System.out.println("最小公倍数是：" + lcm);
    }

    // 求最大公约数
    public static int gcd(int m, int n) {
        if (m < n) {
            int t = m;
            m = n;
            n = t;
        }
        while (n != 0) {
            int r = m % n;
            m = n;
            n = r;
        }
        return m;
    }
}
